package com.cf.controller;

import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.cf.mapper.CheckAttendanceMapper;
import com.cf.utils.DateUtils;
import com.cf.utils.R;

@RestController
@RequestMapping("/checkAttendance")
public class CheckAttendanceController extends AbstractController {
	@Resource
	CheckAttendanceMapper checkAttendanceMapper;

	@RequestMapping("/list")

	public R queryList(@RequestBody JSONObject prams) {

		Date startDate = DateUtils.getDate(prams.getString("startDate"));
		Date endDate = DateUtils.getDate(prams.getString("endDate"));
		String name = prams.getString("name");

		List<LinkedHashMap<String, Object>> lstCheckAttendance = checkAttendanceMapper
				.listCA(startDate, endDate, name);
		R r = new R();
		r.put("code", 200);

		r.put("lstCheckAttendance", lstCheckAttendance);
		return r;
	}
}
